<template>
  <div class='container'>
    <!-- 试题审核对话框 -->
      <el-dialog title="题目审核" :visible="isQuestions" width="30%" @close="hClose">
        <el-form :model="form" :data="form" ref="form">
            <el-form-item>

            <el-radio v-model="form.chkState" :label="1">通过</el-radio>

            <el-radio v-model="form.chkState" :label="2">拒绝</el-radio>
          </el-form-item>
          <el-form-item>
              <el-input type="textarea" placeholder="请输入审核意见" v-model="form.chkRemarks"></el-input>
          </el-form-item>
          <el-form-item>
            <!-- <div slot="footer" class="dialog-footer"> -->
              <el-button @click="hClose">取 消</el-button>
              <el-button type="primary" @click="btnOK">确 定</el-button>
            <!-- </div> -->
          </el-form-item>
        </el-form>
    </el-dialog>
  </div>
</template>

<script>
import { chkType } from '@/api/hmmm/constants.js'
import { choiceCheck } from '@/api/hmmm/questions.js'
export default {

  props: {
    isQuestions: {
      type: Boolean,
      required: true
    },
    titlePreview: {
      type: Object,
      required: true
    },
    curId: {
      type: Number,
      required: true
    }
  },
  data () {
    return {
      chkType,
      form: {
        chkState: 1,
        chkRemarks: ''
      }
    }
  },
  methods: {
    clear () {
      // console.log(1)
      this.form = {
        chkState: 1,
        chkRemarks: ''
      }
      // this.$refs.form.resetFields()
    },
    hClose () {
      // this.clear()
      this.$emit('update:isQuestions', false)
      console.log(1)
    },
    async btnOK () {
      this.form.id = this.curId
      await choiceCheck(this.form)

      this.$message.success('审核完成')
      this.$emit('getChoice')
      this.$refs.form.resetFields()
      this.clear()
      this.hClose()
    }
  }
}
</script>

<style scoped lang='scss'>
.el-input{
    width: 400px;
}
</style>
